package com.order.itemcategoryproject.service.lmpl;

import com.order.itemcategoryproject.mapper.dArcItemMapper;
import com.order.itemcategoryproject.pojo.VO.dArcItemVo;
import com.order.itemcategoryproject.pojo.dArcItem;
import com.order.itemcategoryproject.service.dArcItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class dArcItemServicelmpl implements dArcItemService {


    @Autowired
    private dArcItemMapper dArcItemMapper;


    /**
     * 通过商品小类编号获取改编号下的所有商品
     *
     * @param categoryId
     * @return
     */
    @Override
    public List<dArcItem> selectAllItemBySmCategory(String searchValue, String categoryId, String storageId, Date futureDates, String lang, String cusSegmentation) {
        return dArcItemMapper.selectAllItemBySmCategory(searchValue, categoryId, storageId, futureDates, lang, cusSegmentation);
    }

    /**
     * 通过商品编号获取商品信息
     *
     * @param itemId
     * @return
     */
    @Override
    public dArcItem selectOneItemById(String itemId, String storageId, String lang, String cusSegmentation) {
        return dArcItemMapper.selectOneItemById(itemId, storageId, lang, cusSegmentation);
    }


    /**
     * 获取热卖商品
     *
     * @return
     */
    @Override
    public List<dArcItem> selectAllHotItemInfoByItemGrade(String storageId, Date futureDates,
                                                          String itemGrade, String lang, String cusSegmentation) {
        return dArcItemMapper.selectAllHotItemInfoByItemGrade(storageId, futureDates, itemGrade, lang, cusSegmentation);
    }


    /**
     * 根据订单编号和客户编码获取该客户订单下所有的订单明细信息
     * 从而使用这些商品编号去商品主表中去检索
     *
     * @param orderId
     * @param createStaffId
     * @return
     */
    @Override
    public List<dArcItem> selectAllItemInfoByOrderIdAndCreateStaffId(String orderId, String createStaffId, String storageId,
                                                                     String lang, String cusSegmentation) {
        return dArcItemMapper.selectAllItemInfoByOrderIdAndCreateStaffId(orderId, createStaffId, storageId, lang, cusSegmentation);
    }


    /**
     * 获取所有商品信息
     *
     * @return
     */
    @Override
    public dArcItem selectAllItemInfo(String itemId, String storageId, String lang, String cusSegmentation) {
        return dArcItemMapper.selectItemInfoByItemId(itemId, storageId, lang, cusSegmentation);
    }


    /**
     * 根据客户编号获取当前客户下拥有的所有有库存的系列
     *
     * @param storageId
     * @return
     */
    @Override
    public List<dArcItemVo> selectAllSeriesByItemSeries(String storageId, String cusSegmentation) {
        return dArcItemMapper.selectAllSeriesByItemSeries(storageId, cusSegmentation);
    }


    /**
     * 根据客户编码以及预计付款时间以及系列名称来获取
     *
     * @param storageId
     * @param futureDates
     * @param seriesName
     * @return
     */
    @Override
    public List<dArcItem> getAllItemSeriesBySeriesName(String storageId, Date futureDates, String seriesName,
                                                       String lang, String cusSegmentation) {
        return dArcItemMapper.getAllItemSeriesBySeriesName(storageId, futureDates, seriesName, lang, cusSegmentation);
    }

    /**
     * 根据商品编号获取当前上传图片维护的人员编号
     * @param itemId
     * @return
     */
    @Override
    public dArcItemVo getStaffIdByItemId(String itemId) {
        return dArcItemMapper.getStaffIdByItemId(itemId);
    }
}
